package org.dromara.comm.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.comm.domain.AsServicePerson;
import org.dromara.comm.domain.AsServiceType;
import org.dromara.comm.service.AsServicePersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 通讯录控制层
 *
 * @author: 郭伟明
 * @date: 2024-08-01 15:12
 **/
@RestController
@RequestMapping("/AsServicePerson")
@Tag(name = "通讯录")
public class AsServicePersonController {

    @Autowired
    private AsServicePersonService asServicePersonService;

    @Operation(summary = "通讯录信息")
    @GetMapping("/getServiceGuideJson")
    public ResponseEntity<Object> getServiceGuideJson(AsServiceType asServiceType) {
        return new ResponseEntity<>(asServicePersonService.getServiceGuideJson(asServiceType), HttpStatus.OK);
    }

    @Operation(summary = "新增分类")
    @PostMapping("/insertAsServiceType")
    public void insertAsServiceType(AsServiceType asServiceType) {
        asServicePersonService.insertAsServiceType(asServiceType);
    }

    @Operation(summary = "新增服务内容")
    @PostMapping("/insertAsServicePerson")
    public void insertAsServicePerson(@RequestBody AsServicePerson asServicePerson, AsServiceType asServiceType) {
        asServicePersonService.insertAsServicePerson(asServicePerson, asServiceType);
    }

    @Operation(summary = "更新分类")
    @PostMapping("/updateAsServiceType")
    public void updateAsServiceType(@RequestBody AsServiceType asServiceType) {
        asServicePersonService.updateAsServiceType(asServiceType);
    }

    @Operation(summary = "更新服务内容")
    @PostMapping("/updateAsServicePerson")
    public void updateAsServicePerson(@RequestBody AsServicePerson asServicePerson) {
        asServicePersonService.updateAsServicePerson(asServicePerson);
    }

    @Operation(summary = "删除服务内容")
    @GetMapping("/deleteAsServicePerson")
    public void deleteAsServicePerson(AsServicePerson asServicePerson) {
        asServicePersonService.deleteAsServicePerson(asServicePerson);
    }
}
